package com.example.designpatterns.creational.simplefactory;

import com.example.designpatterns.creational.simplefactory.product.IShape;

/**
 * 简单工厂
 *
 * @author scott
 */
public class ShapeFactory {

    /**
     * 创建图形对象
     */
    public static IShape create(Class<? extends IShape> clazz) {
        if (null != clazz) {
            try {
                return clazz.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }

}
